#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import sys
# sys.setrecursionlimit(1000000)
lii = [174, 321, 399, 92, 566, 153, 226, 816, 856, 136]
li = [5,7,4,6,3,1,2,9,8]
def partition_sort(li,left,right):
    tmp = li[left]
    while left < right:
        while left < right and li[right] >= tmp:#从右边找比tmp小的数
            right -= 1#往左边走一步
        li[left] = li[right]#把右边的值写到左边空位上
        #print(li,'right')
        while left < right and li[left] <= tmp:#从左边找比tmp大的数
            left += 1#往右边走一步
        li[right] = li[left]#把这边的值写到右边的空位上
        #print(li,'left')
    li[left] = tmp #把tmp归位
    #print(li)
    return left

def quick_sort(li,left,right):
    if left < right:
        mid = partition_sort(li,left,right)
        quick_sort(li,left,mid-1)
        quick_sort(li,mid+1,right)
print(lii)
quick_sort(lii,0,len(lii)-1)
print(lii)


